package af.Class;

import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
import java.sql.ResultSet;


import af.Form.LoginForm;
import af.Form.ResponsableForm;
import af.tools.Credencial;

public class Login extends ConexionBD{
	private Connection cn = null;
	private Statement st = null;
	String sSql ="";
	boolean bReturn=false;
	
	public boolean autentificarUser(Credencial credencial){
		try{
			cn = getConection();
			st = cn.createStatement();		
								
			sSql="Select * FROM actfijo_usuarios"
				+ " WHERE user='" + credencial.getUserName() + "' AND pass='" + credencial.getPassword() + "'";
			
			ResultSet rs = st.executeQuery(sSql);
			if(rs.next()){
				bReturn=true;
			}
			cn.close();
			st.close();	
		}catch (Exception e){
			e.printStackTrace();
		}
		return bReturn;		
	}
}
